import Koa from "koa";
import bodyParser from "koa-bodyparser";
import address from "address";
import router from "./router";
import opn from "opn";

const app = new Koa();
const cors = require("koa2-cors");

app.use(cors());
app.use(bodyParser());

app.use(router.routes());
app.listen(3000);
console.log("server is running at port 3000......");

let localhost = address.ip() || "localhost";
let uri = `http://${localhost}:3000/getData`;
// opn(uri);

console.log("lisening in ", uri);
